//
//  HeaderCollectionReusableView.m
//  TheDifferentWorld
//
//  Created by dllo on 15/9/23.
//  Copyright (c) 2015年 LZY. All rights reserved.
//

#import "HeaderCollectionReusableView.h"

@implementation HeaderCollectionReusableView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.myImageView = [[UIImageView alloc] init];
        self.button = [UIButton buttonWithType:UIButtonTypeSystem];
        
        [self.button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
        
        [self addSubview:self.myImageView];
        
        self.myLabel = [[UILabel alloc] init];
        
        self.myLabel.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.4];

        
        
        self.myLabel.textColor = [UIColor whiteColor];
        
        self.button.backgroundColor = [UIColor clearColor];
       
        self.myImageView.userInteractionEnabled = YES;
       
        [self.button addSubview:self.myLabel];
        
        [self.myImageView addSubview:self.button];
        
    }
    return self;
}
- (void)buttonAction:(UIButton *)button
{
    
    [self.delegate passToTableView];
    
}


- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    self.myImageView.frame = CGRectMake(10, 0, layoutAttributes.bounds.size.width - 20, 150);
    self.button.frame = CGRectMake(0, 0, layoutAttributes.bounds.size.width - 20, 150);
    self.myLabel.frame = CGRectMake(0, 130, layoutAttributes.bounds.size.width - 20, 20);
}







@end
